package view;

import java.awt.Dimension;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class ResultFrame extends JFrame{
	
	public JPanel mainPanel;
	public JLabel resultLabel;
	public JButton okButton;
	
	public ResultFrame()
	{
		mainPanel = new JPanel();
		resultLabel = new JLabel();
		okButton = new JButton("OK");
		
		
		resultLabel.setPreferredSize(new Dimension(150, 40));
		okButton.setPreferredSize(new Dimension(60, 30));
		mainPanel.setPreferredSize(new Dimension(150, 100));
		this.setPreferredSize(new Dimension(150, 100));
		
		mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));
		mainPanel.add(resultLabel);
		resultLabel.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
		mainPanel.add(okButton);
		okButton.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
		this.setContentPane(mainPanel);
		this.setDefaultCloseOperation(HIDE_ON_CLOSE);
		
	}
	
	public void displayResult(double r)
	{
		resultLabel.setText("Result : " + r);
		this.setTitle("Results");
		this.setSize(400, 80);
		repaint();
		this.setVisible(true);
		
	}
	
	

}
